<?php
 
if (!defined('EXPONENT')) exit('');

$contact = null;
if (isset($_GET['id'])) {
	$contact = $db->selectObject('contact_contact','id='.intval($_GET['id']));
	if ($contact) {
		$loc = unserialize($contact->location_data);
	}
}

if (exponent_permissions_check('configure',$loc)) {
	$form = contact_contact::form($contact);
	$form->location($loc);
	$form->meta('action','save_contact');
	
	$template = new template('contactmodule','_form_edit_contact',$loc);
	$template->assign('form_html',$form->toHTML());
	$template->assign('is_edit', (isset($_GET['id']) ? 1 : 0) );
	$template->output();
} else {
	echo exponent_http_error(403);
}

?>